package io;

public class Logger {
	private static long startingTime;
	private static boolean starting;
	
	public static void init(){
		startingTime = System.nanoTime();
		starting = true;
		try {
			Thread.sleep(50);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		logln(Logger.class,"Logger ready...");
	}
	
	public static void log(Class<?> c, String message){
		if(starting){
			starting = false;
			System.err.println((System.nanoTime()-startingTime)+" : "+c.getName()+" : \n"+message);
		} else {
			System.err.println(message);
		}
	}
	
	public static void flush(){
		starting = true;
		System.err.println();
	}
	
	public static void logln(Class<?> c, String message){
		if(!starting){
			starting = true;
			System.err.println();
		}
			
		System.err.println((System.nanoTime()-startingTime)+" : "+c.getName()+" : \n"+message);
	}
	
}
